#!/usr/bin/perl -w

##HACKABOT_HELP##
# Hacker Handle Generator
# !hacker some name
##HACKABOT_HELP##

use strict;
use LWP::Simple;
use URI::Escape;
use HTML::Entities;

my ($nick, $msg);
while (<>) {
	if (/^nick\s*(\S*)/) {
		$nick = $1;
	}
	elsif (/^msg\s*(.*)/) {
		$msg = $1;
	}
}

if (defined $nick and defined $msg) {
	$msg =~ s/\s*$//;
	$msg = uri_escape($msg);
	my $slogan = `curl -s -d "name=$msg" http://www.rootcompromise.org/hhg/ | grep filter:glow | sed -e 's/<[^>]*>//g' -e 's/^ *//g'`;
	chomp $slogan;

	$slogan = decode_entities($slogan);

	print "send $nick: $slogan";
}
else {
	die "slogan: nick or message not defined :-/\n";
}
